#ifndef __UART_SOFT_H
#define __UART_SOFT_H

#include "stm32f0xx_hal.h"

#define SOFT_UART_RX_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOA_CLK_ENABLE()
#define SOFT_UART_TX_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOA_CLK_ENABLE() 

/* Definition for UARTx Pins */
#define SOFT_UART_TX_PIN                    GPIO_PIN_9
#define SOFT_UART_TX_GPIO_PORT              GPIOA
#define SOFT_UART_RX_PIN                    GPIO_PIN_10
#define SOFT_UART_RX_GPIO_PORT              GPIOA

#define SOFT_UART_TX_L  HAL_GPIO_WritePin(SOFT_UART_TX_GPIO_PORT,SOFT_UART_TX_PIN,GPIO_PIN_RESET)
#define SOFT_UART_TX_H  HAL_GPIO_WritePin(SOFT_UART_TX_GPIO_PORT,SOFT_UART_TX_PIN,GPIO_PIN_SET)
#define SOFT_UART_RX    HAL_GPIO_ReadPin(SOFT_UART_RX_GPIO_PORT,SOFT_UART_RX_PIN)

typedef struct {
  uint8_t stepStart;
  uint8_t stepData;
  uint8_t stepEnd;
  uint8_t data;
}_uartRecvState_t;

typedef enum {
  BIT0,
  BIT1,
  BIT2,
  BIT3,
  BIT4,
  BIT5,
  BIT6,
  BIT7,
}_uartRecv_e;

void SOFT_UART_Init(void);
void SOFT_UART_SendByte(uint8_t c);
void SOFT_UART_SendBytes(uint8_t *pSendBuf,uint32_t size);
void SOFT_UART_ReceiveByte(void);

#endif/*__UART_SOFT_H*/
